package com.joinlabs.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.joinlabs.entity.User;
import com.joinlabs.exception.CustomException;
import com.joinlabs.mapper.UserMapper;
import com.joinlabs.service.IUserService;
@Service("userService")
public class UserServiceImpl implements IUserService {
  @Resource
  private UserMapper userMapper;
	@Override
	public User checkLogin(User loginUser) throws CustomException {
		//通过名字查询
		User successUser=userMapper.findUserByName(loginUser.getUserName());
		//验证手机证码是否正确
		if(successUser==null){
			throw new CustomException("用户名不存在");
		}
		if(!successUser.getUserPwd().equals(loginUser.getUserPwd())) {
			throw new CustomException("密码错误");
		}
		return successUser;
	}

}
